package com.yfq.springframework.context.support;

import com.yfq.springframework.beans.support.DefaultListableBeanFactory;
import com.yfq.springframework.beans.xml.XmlBeanDefinitionReader;

/**
 * @author 姚凤桥
 * @date 2023/1/19 15:01
 * @description
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (configLocations != null) {
            xmlBeanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();
}
